<?php
namespace app\cms\controller;

use think\Controller;

class Member extends Controller
{
    public function login()
    {
        $msg=null;
        if(request()->isPost())
        {
            $cms=model("cms");
            $cms=$cms->get(["username"=>input("post.username"),"password"=>input("post.password")]);
            if($cms==null){
                $msg="用户名或者密码不正确";
            }else{
                session("cms",$cms);
                $this->redirect("index/index");
            }

        }
        return view("login",array("msg"=>$msg));
    }
    public function logout()
    {
        session("cms",null);
        $this->redirect("member/login");;
    }

}
